<?php defined( '_VALID_MOS' ) or die( 'Restricted access' );?>
<?php 
// url of current page that user will be returned to after login
$url = mosGetParam( $_SERVER, 'REQUEST_URI', null );
if ( strpos($url, 'http:') !== 0 && strpos($url, 'https:') !== 0 ) {
	if (strpos($url, '/') !== 0) {
		$url = '/'. $url;
	}
	$url = mosGetParam( $_SERVER, 'HTTP_HOST', null ) . $url;
	if ( isset( $_SERVER['HTTPS'] ) && ( !empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] != 'off' ) ) {
		$return = 'https://'. $url;
	} else {
		$return = 'http://'. $url;
	}
} else {
	$return = $url;
}
global $JCS_TITLE_AR;
if($_SESSION['jcs_access_url']) $return = $_SESSION['jcs_access_url'];
$itemid = mosGetParam($_REQUEST, 'Itemid');
// converts & to &amp; for xtml compliance
$return 				= str_replace( '&', '&amp;', $return );
 ?>
<table class="contentpaneopen" width="100%">
  <TR>
    <td class="componentheading">
    <?php echo $JCS_TITLE_AR; ?>
    </td>
  </TR>
</table>

<div class="contentheading">
	<?php echo _DO_LOGIN; ?>
</div>
<div class="contentpaneopen">

  <?php
	$validate = josSpoofValue(1);
	if($mosmsg) echo  '<p><h3>'.$mosmsg."</h3></p>";
	?>
	<form action="<?php echo sefRelToAbs( 'index.php' ); ?>" method="post" name="login" >
	<input type="hidden" name="return" value="<?php echo sefRelToAbs( $return ); ?>" />
	<input type="hidden" name="option" value="login" />
	<input type="hidden" name="op2" value="login" />
	<input type="hidden" name="Itemid" value="<?php echo $itemid ?>" />
	<input type="hidden" name="lang" value="<?php echo $mosConfig_lang; ?>" />
	<input type="hidden" name="<?php echo $validate; ?>" value="1" />
  <input type="hidden" name="force_session" value="1" />

	<table width="100%" border="0" cellspacing="5" cellpadding="2">
	<tr>
		<td width="1%"> <label for="mod_login_username">
				<?php echo _USERNAME; ?>
			</label></td>
		<td><input name="username" id="mod_login_username" type="text" 
	            class="inputbox" alt="username" size="10" style="width:90%" /></td>
		<td width="1%"> <label for="mod_login_password">
				<?php echo _PASSWORD; ?>
			</label></td>
		<td><input type="password" id="mod_login_password" name="passwd" 
	            class="inputbox" size="10" alt="password" style="width:90%" /></td>
    </tr>
  </table>
  <table width="100%" border="0" cellspacing="8" cellpadding="0">
    <TR>
      <TD><a href="<?php echo sefRelToAbs( 'index.php?option=com_registration&amp;task=lostPassword&Itemid='.$itemid ); ?>">
				<?php echo _LOST_PASSWORD; ?></a></TD>
      <TD><?php
	if ( $mainframe->getCfg( 'allowUserRegistration' ) ) {
		?>
				<?php echo _NO_ACCOUNT; ?>
        <a href="<?php
         
         switch(JEConfig::get('general.register'))
         {
            case "JUser":
                $url = 'index.php?option=com_juser&amp;task=UserRegistration&Itemid='.$itemid;
            break;
            
            case "Community Builder":
                $url = 'index.php?option=com_comprofiler&amp;task=registers&Itemid='.$itemid;
            break;
            
            case "Core Joomla":
                $url = 'index.php?option=com_registration&amp;task=register&Itemid='.$itemid;
            break;
            
            Default:
              $url = 'index.php?option=com_jcs&amp;task=register&Itemid='.$itemid;
         } 
         echo sefRelToAbs( $url ); 
         
         ?>">
					<?php echo _CREATE_ACCOUNT; ?></a>
		<?php
	}
	?></TD>
    <TD>
			<label for="mod_login_remember">
				<?php echo _REMEMBER_ME; ?>
			</label> <input type="checkbox" name="remember" id="mod_login_remember" class="inputbox" value="yes" alt="Remember Me" /></TD>
     <TD><input type="submit" name="Submit" class="button" value="<?php echo _BUTTON_LOGIN; ?>" /></TD>
   </TR>
  </table>
  </form>
</div>
<BR>
<BR>
